import request from '@/utils/request';

/**
 * 要素版本信息分页列表查询
 * @param {*} reqWrapperData 
 * @returns 
 */
export function pageList(reqWrapperData) {
    const {query, data} = reqWrapperData
  return request({
    url: '/datastandard/business/fieldDomain/list',
    method: 'post',
    headers: {'X-HTTP-Method-Override': 'GET'},
    params: {
        page:query.page,
        pageSize:query.pageSize
    },
    data:{
        id:data.id,
        domainKey:data.domainKey,
        domainValue:data.domainValue,
        fieldName:data.fieldName,
        domainOrder:data.domainOrder,
        domainDesc:data.domainDesc,
        featureVersionId:data.featureVersionId,
        createTime:data.createTime,
        updateTime:data.updateTime,
        isDeleted:data.isDeleted,
        fieldAlias:data.fieldAlias,
        fieldType:data.fieldType,
        fieldLength:data.fieldLength,
        fieldPrecision:data.fieldPrecision,
        isNullable:data.isNullable,
        isUnique:data.isUnique,
        isStandard:data.isStandard,
        canEnum:data.canEnum,
        fieldOrder:data.fieldOrder,
        versionName:data.versionName,
        versionCName:data.versionCName,
        versionSerial:data.versionSerial,
        featureId:data.featureId,
        featureName:data.featureName,
        featureCName:data.featureCName,
        isGeometry:data.isGeometry,
        geometryType:data.geometryType,
        businessType:data.businessType,
        updateMethod:data.updateMethod,
        updateRate:data.updateRate
    }
  });
}

/**
 * 添加一个新的要素版本信息
 * @param {*} reqWrapperData 
 * @returns 
 */
export function addOne(reqWrapperData) {
  const {data} = reqWrapperData
  return request({
    url: '/datastandard/fieldDomain/add',
    method: 'post',
    data:{
      id: data.id,
      domainKey: data.domainKey,
      domainValue: data.domainValue,
      filedName: data.filedName,
      domainOrder: data.domainOrder,
      domainDesc:data.domainDesc,
      featureVersionId: data.featureVersionId,
      standardDocId:data.standardDocId,
    }
  });
}


/**
 * 修改一个新的要素版本信息
 * @param {*} reqWrapperData 
 * @returns 
 */
 export function updateOne(reqWrapperData) {
  const {data} = reqWrapperData
  return request({
    url: '/datastandard/fieldDomain/update',
    method: 'put',
    data:{
      id: data.id,
      domainKey: data.domainKey,
      domainValue: data.domainValue,
      filedName: data.filedName,
      domainOrder: data.domainOrder,
      domainDesc:data.domainDesc,
      featureVersionId: data.featureVersionId,
      standardDocId:data.standardDocId,
    }
  });
}


/**
 * 修改一个要素版本信息
 * @param {*} reqWrapperData 
 * @returns 
 */
export function deleteOne(reqWrapperData) {
  const {query} = reqWrapperData
  return request({
    url: '/datastandard/fieldDomain/delete',
    method: 'delete',
    params:{
      id:query.id
    }
  });
}


/**
 * 批量导入字段值域数据
 * @param {*} reqFormData 
 * @returns 
 */
 export function importBatchData(reqFormData){
  return request({
    url:'/datastandard/fieldDomain/importBatchData',
    method:'post',
    data:reqFormData
  })
}